/**
 * 首页
 */
function caseSelectionVoteIndex() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/index";
}

/**
 * 规则
 */
function ruleDetailsRegister() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/caseUploadRegister";
}

/**
 * 注册
 */
function registerPlayer() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/registerPlayer";
}

/**
 * 我的
 */
function myRankingStatistics() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/myRankingStatistics";
}

/**
 * 个人中心
 */
function personalCenter() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/personalCenter";
}

/**
 * 点击查看该医院所有病例
 */
function viewCaseSet(obj) {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/scoreViewCases/" + obj;
}

/**
 * 点击查看医院提交病例详情
 */
function caseScoring(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/caseScoring/" + fullObj;
}

/**
 * 点击查看患者信息
 */
function patientInformation(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/patientInformation/" + fullObj;
}

/**
 * 点击查看临床病例
 */
function clinicalCase(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/clinicalCase/" + fullObj;
}

/**
 * 点击查看辅助检查
 */
function supplementary(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/supplementary/" + fullObj;
}

/**
 * 点击查看治疗设计
 */
function treatmentDesign(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/treatmentDesign/" + fullObj;
}

/**
 * 点击查看治疗步骤
 */
function treatmentStepsDetails(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/treatmentStepsDetails/" + fullObj;
}

/**
 * 点击查看术后跟踪
 */
function postoperative(obj) {
    var fullName = $("#fullNameValue").val();
    var fullObj = fullName + ',' + obj;
    window.location.href = Feng.ctxPath + "/caseSelectionVote/postoperative/" + fullObj;
}

/**
 * 显示活动详情
 */
function displayDetails(obj) {
    $("#activityDetails").toggle();
    $(obj).children('span').toggle();
}

function outLogin() {
    $.ajax({
        url: Feng.ctxPath + "/logout",
        type: "get",
        success: function (data) {
            window.location.href = Feng.ctxPath + "/caseSelectionVote/index";
        },
        error: function (data) {
            alert('没有权限，请联系管理员!');
        }
    });
}

/**
 * 跳转到选手详情
 */
function enterDetails(obj) {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/enterDetails/" + obj;
}

function personalMaterial() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/case_personalMaterial" ;
}

function personalPassw() {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/case_personalPassword" ;
}

/**
 * 点击注册按钮
 */
$("#searchPlayer").click(function () {  //首页搜索
    var obj = $("#playerIds").val();
    window.location.href = Feng.ctxPath + "/caseSelectionVote/enterDetails/" + obj;
});

$("#searchPlayers").click(function () { //弹出框搜索
    var obj = $("#playerIds").val();
    window.parent.location.href = Feng.ctxPath + "/caseSelectionVote/enterDetails/" + obj;
});

$("#toback").click(function () {
    window.location.href = Feng.ctxPath + "/caseSelectionVote/personalCenter";
});

$('#inTest').click(function () {
    var passWord = $('#passWord').val();
    var newPassWord = $('#newPassWord').val();
    var reNewPassWord = $('#reNewPassWord').val();
    if (newPassWord != reNewPassWord) {
        alert("新密码输入不一致！");
    } else if (newPassWord == null || newPassWord == "") {
        alert("新密码不为空！");
    } else if (newPassWord.length > 20) {
        alert("新密码長度不大于20！");
    } else {
        $.ajax({
            url: Feng.ctxPath + "/caseSelectionUpload/updatePassWord",
            type: "post",
            data: {
                "passWord": passWord,
                "newPassWord": newPassWord
            },
            dataType: "json",
            success: function (data) {
                if (data == '0') {
                    alert("密码修改成功！");
                    window.location.href = Feng.ctxPath + "/caseSelectionVote/myRankingStatistics";
                } else {
                    alert("原密码错误，请重新输入原密码！");
                }
            },
            error: function (data) {
                alert('没有权限，请联系管理员!');
            }
        });
    }
});

$('#playerCaseLogin').click(function () {
    var password_ok_show = true;
    var userName = $('#userName').val();
    var passWord = $('#passWord').val();
    var outpatientName = "待定店";
    localStorage.setItem('userName', userName);
    localStorage.setItem('passWord', passWord);
    localStorage.setItem('outpatientName', outpatientName);
    localStorage.setItem('password_ok_show', password_ok_show);
    $.ajax({
        url: Feng.ctxPath + "/caseSelectionVote/login",
        type: "post",
        data: {
            "username": userName,
            "outpatientName": outpatientName,
            "password": passWord
        },
        success: function (data) {
            window.location.href = Feng.ctxPath + "/caseSelectionVote/myRankingStatistics";
        },
        error: function (data) {
            alert('账号和密码不匹配，请联系管理员!');
            window.location.href = Feng.ctxPath + "/caseSelectionVote/myRankingStatistics";
        }
    });
});